package com.ljx.schedule;

import com.ljx.service.impl.StatisticsDailyServiceImpl;
import com.ljx.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author 李加喜
 * @date 2020/10/3 0003 6:17
 * @Email 1129071273@qq.com
 */
@Component
public class ScheduledTask {
    @Autowired
    private StatisticsDailyServiceImpl statisticsDailyService;
    // 0/5 指的是每个五秒钟执行一次
//    @Scheduled(cron = "0/5 * * * * ?")
//    public void test01(){
//        System.out.println("执行了");
//    }
//    //每天凌晨1点 将前一天的数据添加到数据库里面
//    @Scheduled(cron = "0 0 1 * * ?")
//    public void task2() {
//        statisticsDailyService.registerCount(DateUtil.formatDate(DateUtil.addDays(new Date(), -1)));
//    }
}
